package com.aaa.system.Controller.Api;

import com.aaa.entity.OperLog;
import com.aaa.system.aop.annotation.Log;
import com.aaa.system.service.OperLogService;
import com.aaa.system.vo.OperLogVo;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("system/api/operLog")
public class ApiOperLogController {

    @Resource
    private OperLogService operLogService;

    /**
     *查询全部的数据
     */
    @PostMapping("getOperLogList")
    public Result<IPage<OperLog>> getOperLogList(@RequestBody OperLogVo operLogVo){
        System.out.println("operLogVo = " + operLogVo.getDateRange());
        return operLogService.getAllOperLog(operLogVo);
    }
    /**
     * 删除操作日志
     */
    @DeleteMapping("delOperLog/{operIds}")
    public Result<Boolean> delOperLog(@PathVariable Long[] operIds){
        return operLogService.delOperLog(operIds);
    }
    /**
     * 清空表单所有数据
     */
    @DeleteMapping("clearOperLogTable")
    public Result<String> clearOperLogTable(){
        return operLogService.clearOperLogTable();
    }
}
